package com.xiaoke.api.controller;

import com.xiaoke.api.service.RegionService;
import com.xiaoke.util.common.AjaxMsg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api")
public class RegionController {

    @Autowired
    private RegionService regionService;

    @RequestMapping(value = "/region/list",method = RequestMethod.GET)
    public AjaxMsg regionList(@RequestParam(defaultValue = "0") Integer parentId ){
        return new AjaxMsg(regionService.findByParent(parentId));
    }
}
